<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head th:include="common">
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form id="userTable">
    <div class="modal-dialog" style="margin-top: 10%;">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title text-center" id="myModalLabel">大麦后台登录系统</h4>
            </div>
            <div class="modal-body" id = "model-body">
                <div class="form-group">
                    <input type="text" class="form-control"  placeholder="请输入用户名" name="admNum">
                </div>
                <div class="form-group">

                    <input type="password" class="form-control"  placeholder="请输入密码" name="admPwd">
                </div>

              <!--  <div class="form-group">

                    <input type="text" class="form-control"  placeholder="请输入验证码" style="width: 500px" name="imgCode">
                    <img src="../admlogin/imgCode">
                </div>-->
            </div>
            <div class="modal-footer">
                <div class="form-group">
                    <a class="btn btn-primary form-control" href="javascript:login()">登录</a>
                </div>
            </div>
        </div>
    </div>
</form>
</body>
<script type="text/javascript">




    function login(){
        $.ajax({
            url:"../admlogin/login",
            data:$("#userTable").serialize(),
            success:function(data){
                if (data.code == 200) {
                    alert("登录成功")
                    location.href="../index"
                }
                if (data.code == 202) {
                    alert("账号错误")
                }
                if (data.code == 201) {
                    alert("密码错误")
                }
                if (data.code == 203) {
                    alert("验证码错误")
                }
            }
        })
    }

</script>
</html>